package com.jsnu.xiaochi.service;

import com.jsnu.xiaochi.dao.UserMapper;
import com.jsnu.xiaochi.pojo.User;
import com.jsnu.xiaochi.pojo.UserExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class LoginServiceImpl implements LoginService {
    @Resource
    UserMapper userMapper;

    @Override
    public User userLogin(String username) {
        UserExample userExample = new UserExample();
        userExample.createCriteria().andUsernameEqualTo(username);
        List<User> users = userMapper.selectByExample(userExample);
        if(users.size()!=0){
            return users.get(0);
        }
        return null;
    }

}